﻿using System.Data.Common;

namespace EntityFrameworkVisualizer.VisualizerObjectSources.CommandFormatters
{
    /// <summary>
    /// Implementation of <see cref="IDbCommandFormatter"/>.
    /// </summary>
    /// <typeparam name="T"><see cref="DbCommand"/> type.</typeparam>
    internal abstract class DbCommandFormatter<T> : IDbCommandFormatter where T : DbCommand
    {
        /// <summary>
        /// Sql command.
        /// </summary>
        protected readonly T Command;

        /// <summary>
        /// Initializes a new instance of the <see cref="DbCommandFormatter&lt;T&gt;"/> class.
        /// </summary>
        /// <param name="command">Sql command.</param>
        public DbCommandFormatter(T command)
        {
            this.Command = command;
        }

        /// <summary>
        /// Formatting parameters.
        /// </summary>
        /// <returns>Formatted string.</returns>
        public abstract string DeclareParameters();

        /// <summary>
        /// Formatting stored procedure.
        /// </summary>
        /// <returns>Formatted string.</returns>
        public abstract string FormatStoredProcedure();
    }
}
